#pragma once

#include "CTransition.h"
#include "CMILMatrix.h"
class CUIElement;
class CLayoutTransitionElement;

class CTransition;


class LayoutTransitionStorage
{

public: 
	LayoutTransitionStorage();
	~LayoutTransitionStorage();
	HRESULT RegisterElementForTransitions(CUIElement * pTarget, xvector<CTransition *> & transitions, enum TransitionTrigger trigger);
	HRESULT UnregisterElementForTransitions(CUIElement * pTarget);
	HRESULT RegisterStoryboard(CStoryboard * pStoryboard);
	HRESULT CleanupStoryboard(CStoryboard * pStoryboard);
	HRESULT ClearStoryboards();
	CLayoutTransitionElement * GetPrimaryBrush();
	HRESULT RegisterBrushRepresentation(CUIElement * pTarget, CLayoutTransitionElement * pLT, enum TransitionParent transitionParent);
	HRESULT UnregisterBrushRepresentation(CUIElement * pTarget, CLayoutTransitionElement * pLT, XBOOL removeFromInternalStorage);
	HRESULT CleanupBrushRepresentations(CUIElement * pTarget);
	HRESULT UpdateBrushes(struct XRECTF_WH finalRect);
	HRESULT GetTriggerForPublicConsumption(enum TransitionTriggerPublic * pTrigger);
	enum TransitionTrigger GetTrigger();
	void SetTrigger(enum TransitionTrigger trigger);
	XFLOAT m_rLayoutTransitionWidth;
	XFLOAT m_rLayoutTransitionHeight;
	struct XSIZEF m_currentSize;
	struct XPOINTF m_currentOffset;
	struct XPOINTF m_nextGenerationOffset;
	struct XSIZEF m_nextGenerationSize;
	XUINT32 m_nextGenerationCounter;
	XFLOAT m_opacityCache;
	XFLOAT m_currentScale;
	struct XRECTF_WH m_arrangeInput;
	struct XRECTF_WH m_arrangeOutput;
	struct XSIZEF m_sizeStart;
	struct XSIZEF m_sizeDestination;
	CMILMatrix m_transformStart;
	CMILMatrix m_transformDestination;
	XFLOAT m_opacityStart;
	XFLOAT m_opacityDestination;
	XFLOAT m_scaleStart;
	XFLOAT m_scaleDestination;
	xvector<CStoryboard *> m_transitionStoryboards;
	xvector<CTransition *> m_registeredTransitions;
	XBOOL m_bRegisteredInLayoutManager;
private: 
	enum TransitionTrigger m_trigger; 
	xvector<CLayoutTransitionElement *> m_transitionElements;


};